package phoenixAAD.WifiFlashDrive;

/**
 * 3.4 Transfer Mode<br>
 * The methods of transferring the data<br><br>
 * Default: STREAM<br>
 * Restart supported: BLOCK
 */
public enum TransferMode{
	/**
	 * The data is transmitted as a stream of bytes.<br>
	 * There is no restriction on the representation type used; record structures are allowed.
	 */
	STREAM,
	/**
	 * The file is transmitted as a series of data blocks preceded by one or more header bytes.
	 */
	@Deprecated
	BLOCK,
	/**
	 * Out of scope, not implemented
	 */
	@Deprecated
	COMPRESSED;
	
	/**
	 * Converts the character into the corresponding enum
	 * @throws NotImplementedException the specified transfer mode is not implemented
	 * @throws SyntaxException bad argument was passed
	 */
	public static TransferMode getMode(char representation) throws NotImplementedException, SyntaxException
	{
		representation = Character.toUpperCase(representation);
		switch(representation)
		{
		case 'S':
			return STREAM;
		case 'B':
			throw new NotImplementedException(Response.ARGUMENT_NOT_IMPLEMENTED);
			//return BLOCK;
		case 'C':
			throw new NotImplementedException(Response.ARGUMENT_NOT_IMPLEMENTED);
		default:
			throw new SyntaxException(Response.BAD_ARGUMENT);
		}
	}
}
